// 引入处理 Vue 文件的 VueLoaderPlugin
const VueLoaderPlugin = require("vue-loader/lib/plugin");
// 引入用于定义全局常量的 DefinePlugin
const DefinePlugin = require("webpack/lib/DefinePlugin");
// 引入用于确保文件路径大小写敏感性的 CaseSensitivePathsPlugin
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
// 引入用于友好显示错误和警告的 FriendlyErrorsWebpackPlugin
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
// 引入用于生成 HTML 文件的 HtmlWebpackPlugin
const HtmlWebpackPlugin = require("html-webpack-plugin");
// 引入用于复制文件或目录的 CopyPlugin
const CopyPlugin = require("copy-webpack-plugin");
// 引入用于集成 ESLint 的 ESLintWebpackPlugin
const ESLintWebpackPlugin = require("eslint-webpack-plugin");
// 导出这些插件的配置
module.exports = [
    // 使用 VueLoaderPlugin 处理 .vue 文件
    new VueLoaderPlugin(),
    // 定义全局常量
    new DefinePlugin({
        'process.env': {
            NODE_ENV: '"development"',
            BASE_URL: '"/"'
        }
    }),
    // 确保文件路径大小写敏感性
    new CaseSensitivePathsPlugin(),
    // 友好显示错误和警告
    new FriendlyErrorsWebpackPlugin({
        additionalTransformers: [function () { }],
        additionalFormatters: [function () { }]
    }),
    // 生成 HTML 文件
    new HtmlWebpackPlugin({
        title: 'cliproject3',
        scriptLoading: 'defer',
        templateParameters: function () { },
        template: 'C:/cliproject/public/index.html'
    }),
    // 复制文件或目录
    new CopyPlugin({
        patterns: [{
            from: 'C:/cliproject/public',
            to: 'C:/cliproject/dist',
            toType: 'dir',
            noErrorOnMissing: true,
            globOptions: {
                ignore: ['**/.DS_Store', 'C:/aprepare/cliproject3/public/index.html']
            },
            info: {
                minimized: true
            }
        }]
    }),
    // 集成 ESLint
    new ESLintWebpackPlugin({
        extensions: ['.js', '.jsx', '.vue'],
        cwd: 'C:\aproject\zhufengvuesystem\7.vuecli',
        cache: true,
        cacheLocation: 'C:/cliproject/node_modules/.cache/eslint/3d1771e1.json',
        context: 'C:\aproject\zhufengvuesystem\7.vuecli',
        failOnWarning: false,
        failOnError: true,
        eslintPath: 'C:/cliproject/node_modules/eslint',
        formatter: 'stylish'
    })
];